﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package reprise.controls {
    import reprise.ui.*;
    import flash.display.*;

    public class BitmapElement extends UIComponent {

        protected var m_smoothing:Boolean = true
        protected var m_image:Bitmap;
        protected var m_imageDisplayed:Boolean;

        public function setSmoothing(_arg1:Boolean):void{
            m_smoothing = _arg1;
            if (m_image){
                setBitmapData(m_image.bitmapData);
            };
        }
        override protected function applyInFlowChildPositions():void{
            if (!((m_image) && (m_image.bitmapData))){
                return;
            };
            if (!m_imageDisplayed){
                m_imageDisplayed = true;
                m_lowerContentDisplay.visible = true;
            };
            m_image.x = m_currentStyles.paddingLeft;
            m_image.y = m_currentStyles.paddingTop;
            if (m_autoFlags.height){
                m_image.height = m_image.bitmapData.height;
            } else {
                m_image.height = m_currentStyles.height;
            };
            if (m_autoFlags.width){
                m_image.width = m_image.bitmapData.width;
            } else {
                m_image.width = m_currentStyles.width;
            };
        }
        override protected function initDefaultStyles():void{
            m_elementDefaultStyles.setStyle("display", "inline");
        }
        protected function createBitmapDisplay(_arg1:BitmapData):void{
            ((!(m_lowerContentDisplay)) && (createLowerContentDisplay()));
            if (!m_firstDraw){
                m_imageDisplayed = false;
                m_lowerContentDisplay.visible = false;
            };
            if (((m_image) && (m_image.parent))){
                m_image.parent.removeChild(m_image);
            };
            m_image = new Bitmap(_arg1, "auto", m_smoothing);
            m_lowerContentDisplay.addChild(m_image);
            invalidate();
        }
        public function bitmapData():BitmapData{
            if (!m_image){
                return (null);
            };
            return (m_image.bitmapData);
        }
        override protected function applyOutOfFlowChildPositions():void{
        }
        public function setBitmapData(_arg1:BitmapData):void{
            createBitmapDisplay(_arg1);
        }
        function innerHeight():int{
            return (m_contentBoxHeight);
        }
        override protected function measure():void{
            if (!m_imageDisplayed){
                m_intrinsicWidth = 0;
                m_intrinsicHeight = 0;
                return;
            };
            m_intrinsicWidth = m_image.bitmapData.width;
            m_intrinsicHeight = m_image.bitmapData.height;
        }
		override public function innerWidth():int{
            return (m_contentBoxWidth);
        }

    }
}//package reprise.controls 
